<?php

/**
 * Doctor form base class.
 *
 * @method Doctor getObject() Returns the current form's model object
 *
 * @package    docplus.co.za
 * @subpackage form
 * @author     Fox Matuku
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDoctorForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'practice_name'          => new sfWidgetFormInputText(),
      'practice_number'        => new sfWidgetFormInputText(),
      'user_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'date_of_birth'          => new sfWidgetFormDateTime(),
      'gender'                 => new sfWidgetFormChoice(array('choices' => array('Male' => 'Male', 'Female' => 'Female'))),
      'language_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Language'), 'add_empty' => false)),
      'speciality_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Speciality'), 'add_empty' => false)),
      'professional_statement' => new sfWidgetFormTextarea(),
      'is_mobile_activated'    => new sfWidgetFormInputCheckbox(),
      'is_email_activated'     => new sfWidgetFormInputCheckbox(),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'practice_name'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'practice_number'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'user_id'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'date_of_birth'          => new sfValidatorDateTime(array('required' => false)),
      'gender'                 => new sfValidatorChoice(array('choices' => array(0 => 'Male', 1 => 'Female'))),
      'language_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Language'))),
      'speciality_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Speciality'))),
      'professional_statement' => new sfValidatorString(array('max_length' => 5000, 'required' => false)),
      'is_mobile_activated'    => new sfValidatorBoolean(array('required' => false)),
      'is_email_activated'     => new sfValidatorBoolean(array('required' => false)),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('doctor[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Doctor';
  }

}
